//const url = require('../../utils/requireurl.js').url;
Page({
  /**
   * 页面的初始数据
   */
  data: {
    loading: false,
    contact: '',
    content: ''
  },

  formSubmit: function (e) {
    let _that = this;
    let content = e.detail.value.opinion;
    let contact = e.detail.value.contact;
    //console.log("这是反馈内容  "+content+"这是电话"+contact);
    if (content == "") {
      wx.showModal({
        title: '提示',
        content: '反馈内容不能为空!',
      })
      return false
    }

    if (contact == "") {
      wx.showModal({
        title: '提示',
        content: '手机号不能为空!',
      })
      return false
    }

    if (contact == "" && content == "") {
      wx.showModal({
        title: '提示',
        content: '反馈内容,手机号不能为空!',
      })
      return false
    }

    wx.request({
      url: 'http://172.23.207.77:8080/user/save',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: {
        'content': content,
        'contact': contact,
      },
      method: 'POST',
      success: function (res) {
        let status = res.data;
        if (status == true) {
          wx.showToast({
            title: '成功',
            icon: 'success',
            duration: 1500
          })
        }
      },
      fail: function () {
        console.log("意见反馈接口调用失败")
      }
    })
   
  },

  back: function(e) {
    wx.navigateBack({
      delta: 1
    });
  }
})
